import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class IntegerBinary {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int key=sc.nextInt();
        sc.nextLine();
        int []nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        int l=0,r=n-1;
        while(l<r){
            int mid=l+r>>1;
            if(nums[mid]>=key) r=mid;
            else l=mid+1;
        }
        if(nums[l]!=key) System.out.println("-1 -1");
        else {
            System.out.print(l+" ");
            int i=0,j=n-1;
            while(i<j){
                int mid=i+j+1>>1;
                if(nums[mid]<=key) i=mid;
                else j=mid-1;
            }
            System.out.print(i);
        }
    }
}
